package com.gyt.manager.controller.risk;

import com.gyt.manager.common.base.BaseController;
import com.gyt.manager.common.base.exception.BaseException;
import com.gyt.manager.common.base.response.Response;
import com.gyt.manager.domain.risk.PlanUser;
import com.gyt.manager.service.PlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author gyt
 */
@RestController
@RequestMapping("resource")
@Api(tags = "resource-plan", description = "资源中心-计划",value = "plan")
public class PlanController extends BaseController {

    @Autowired
    PlanService planService;

    @GetMapping("plan/findPlanUserById.do")
    @ApiOperation(value = "根据主键获取计划用户信息", notes = "计划")
    public Response<PlanUser> findPlanUserById(
            @ApiParam(value = "主键id", required = true) @RequestParam(value = "id") Integer id){
        try {
            PlanUser planUser = planService.findPlanUserById(id);
            return Response.ok(planUser, null);
        } catch (BaseException e){
            return Response.error(e, null);
        } catch (Exception e){
            return Response.error(null);
        }
    }
}
